﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Runtime.InteropServices;
// MakePanoForGoogle, Copyright Mirosław M. Mączka.  All Rights Reserved. This code released under the terms of the Microsoft Public License (MS-PL, http://opensource.org/licenses/ms-pl.html.)

namespace MakePanoForGoogle
{
    [Guid("F3059B09-8418-4743-85A5-B3FFDC74C1B3")]
    public interface IComMakePanoForGoogle
    {
        int DefaultMaxMegaBytes { get; }
        int DefaultMaxMegaPixels { get; }

        int MaxMPixels { get; set; }
        int MaxMegaBytes { get; set; }
        double VerticalSpan { get; set; }
        double HorizontalSpan { get; set; }
        int PoseHeadingDegrees { get; set; }
        double Latitude { get; set; }
        double Longitude { get; set; }
        DateTime DayTaken { get; set; }
        string Description { get; set; }
        void SetPanoImage(string pathname);
        void Do();
    }//interface

    [Guid("A7A9DBD6-EAE8-476C-8FCF-7142F4E72472"), ClassInterface(ClassInterfaceType.None), ComSourceInterfaces(typeof(IComMakePanoForGoogle))]
    public class ComMakePanoForGoogle : IComMakePanoForGoogle
    {
        MainWindow win;
        public ComMakePanoForGoogle()
        {
            win = new MainWindow();
            win.IsEnabled = false;
        }

        public int DefaultMaxMegaBytes { get { return MainWindow.MaxMegaBytes; } }
        public int DefaultMaxMegaPixels { get { return MainWindow.MaxMegaPixels; } }

        public int MaxMPixels { get { return (int)win.formMaxMPixels; } set { value = (int)win.formMaxMPixels; } }
        public int MaxMegaBytes { get { return (int)win.formMaxMegaBytes; } set { value = (int)win.formMaxMegaBytes; } }
        public double VerticalSpan { get { return (double)win.formVerticalSpan; } set { value = (double)win.formVerticalSpan; } }
        public double HorizontalSpan { get { return (double)win.formHorizontalSpan; } set { value = (double)win.formHorizontalSpan; } }
        public int PoseHeadingDegrees { get { return (int)win.formPoseHeadingDegrees; } set { value = (int)win.formPoseHeadingDegrees; } }
        public double Latitude { get { return (double)win.formLatitude; } set { value = (double)win.formLatitude; } }
        public double Longitude { get { return (double)win.formLongitude; } set { value = (double)win.formLongitude; } }
        public DateTime DayTaken { get { return (DateTime)win.formDayTaken; } set { value = (DateTime)win.formDayTaken; } }
        public string Description { get { return win.formDescription; } set { value = win.formDescription; } }

        public void SetPanoImage(string pathname)
        {

            win.showFile(pathname);
            win.cleanForm();
        }
        public void Do()
        {
            win.do_Click(new object(), new System.Windows.RoutedEventArgs());
        }
    }//class

}//namespace
